import { defineStore } from 'pinia';
import { ref } from 'vue';
import type { CommandSender } from '../commandHelper';

type SendLoginCmd = CommandSender<any, any> | null;

// 1. 先按原来的方式定义Store（完全不变）
export const useLoginStore = defineStore('loginInjection', () => {
  const sendLoginCmd = ref<SendLoginCmd>(null);

  const setInjections = (injections: { sendLoginCmd?: SendLoginCmd }) => {
    if (injections.sendLoginCmd) {
      sendLoginCmd.value = injections.sendLoginCmd;
    }
  };

  return { sendLoginCmd, setInjections };

});